/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.codingbros.eldercare;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author niebje
 */
@Entity
@Table(name = "images_events")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ImagesEvents.findAll", query = "SELECT i FROM ImagesEvents i"),
    @NamedQuery(name = "ImagesEvents.findById", query = "SELECT i FROM ImagesEvents i WHERE i.id = :id"),
    @NamedQuery(name = "ImagesEvents.findByUrl", query = "SELECT i FROM ImagesEvents i WHERE i.url = :url")})
public class ImagesEvents implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Long id;
    @Size(max = 255)
    @Column(name = "url")
    private String url;
    @JoinColumn(name = "events_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Events eventsId;

    public ImagesEvents() {
    }

    public ImagesEvents(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Events getEventsId() {
        return eventsId;
    }

    public void setEventsId(Events eventsId) {
        this.eventsId = eventsId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ImagesEvents)) {
            return false;
        }
        ImagesEvents other = (ImagesEvents) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.codingbros.eldercare.ImagesEvents[ id=" + id + " ]";
    }
    
}
